﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请选择一个机器人类型;1.炒菜  2.传菜");
            string kind = Console.ReadLine();
            Robot c = Testone(kind);
            c.Working();
        }
          public static Robot Testone(string action)
           {
            Robot robot;
            if (action.Equals("炒菜"))
            {
                Console.WriteLine("请选择你想吃的菜：1.中国菜 2.美国菜 3.印度菜");               
                int num = Convert.ToInt32(Console.ReadLine());
                switch (num)
                {
                    case 1:
                        robot = new CookRobot("炒菜", AllEat.中国菜);
                        break;
                    case 2:
                        robot = new CookRobot("炒菜", AllEat.美国菜);
                        break;
                    case 3:
                        robot = new CookRobot("炒菜", AllEat.印度菜);
                        break;
                    default:
                        robot = new CookRobot("傻了吧你", AllEat.中国菜);
                        break;                                         
                }
                return robot;
                //robot.Working();
            }
            else if (action.Equals("传菜"))
            {
                robot = new DeliveryRobot("传菜", 5);
                return robot;
            }
            else
            {
                robot = new DeliveryRobot("傻子吧你", 1000000);
                return robot;
            }
            
        }
        }    
     }
    abstract class Robot{
        public string name { get; set; }
        public Robot(string name)
        {
            this.name = name;
        }

        public abstract void Working();

    }

    class DeliveryRobot : Robot
    {
        public int WorkHours { get; set; }
        public DeliveryRobot(string name, int WorkHours) : base(name)
        {
            this.WorkHours = WorkHours;
        }
        public override void Working()
        {
            Console.WriteLine("我是{0}机器人,我一次性可以干你{1}小时，你喜欢我嘛？？？洋宝！", base.name, this.WorkHours);

        }
    }
    public enum AllEat
    {
        中国菜,
        美国菜,
        印度菜

    }
    class CookRobot : Robot
    {
        public AllEat Eat { get; set; }
        public CookRobot(string name, AllEat Eat) : base(name)
        {
            this.Eat = Eat;
         Console.WriteLine("我是{0}机器人，我会做{1},你喜欢我嘛？？？宝！", base.name, this.Eat);
        }
        public override void Working()
        {
            Console.WriteLine("我是{0}机器人，我会做{1},你喜欢我嘛？？？宝！", base.name, this.Eat);

        }
    }



